package com.techstar.ats.codec.live.decoder;

import io.netty.buffer.ByteBuf;
import com.techstar.ats.codec.MessageDecoder;
import com.techstar.ats.dxp.live.TrainIndication;
import com.techstar.ats.dxp.live.rep.F09TrainIndicationInit;

public enum F09TrainIndicationInitDecoder implements MessageDecoder<F09TrainIndicationInit> {
	INSTANCE;

	public F09TrainIndicationInit create() {
		return new F09TrainIndicationInit();
	}

	public void decode(ByteBuf buf, F09TrainIndicationInit value) {
		value.line = buf.readUnsignedShort();
		int cnt = buf.readUnsignedShort();

		for(int i = 0; i < cnt; ++i) {
			TrainIndication indication = TrainIndicationDecoder.INSTANCE.create();
			TrainIndicationDecoder.INSTANCE.decode(buf, indication);
			value.indications.add(indication);
		}
	}
}
